package name.bingo.bing.pay.service.activity.impl;/**
 * create by yanbing on 2018/11/20 15:26
 */

import com.alibaba.dubbo.config.annotation.Service;
import name.bingo.bing.pay.service.activity.api.IntegralService;
import name.bingo.bing.pay.service.activity.dao.IntegralDao;
import name.bingo.bing.pay.utils.IdGen;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;

/**
 *
 * @param:
 * @return:
 * @auther: yanbing
 * @date: 2018/11/20 15:26
 **/
@Service
public class IntegralServiceImpl implements IntegralService {
    @Autowired
    private IntegralDao integralDao;
    @Override
    public String addIntegral(Map<String,Object> order) {
        //integralDao.findIntegralLog(order.get("out_trade_no"));
        String result="ok";
        try{
            int i=integralDao.addIntegral(order);
            if(i>0){
                order.put("id",IdGen.idGen());
                integralDao.addIntegralDetail(order);
            }
        }catch (Exception e){
            System.out.println(e.getMessage());
            result="error";
        }
        return result;
    }

    @Override
    public String addIntegralDetail() {
        return null;
    }
}
